// SpriteLight.cpp: implementation of the SpriteLight class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "flydx9.h"
#include "SpriteLight.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

SpriteLight::SpriteLight(LPDIRECT3DTEXTURE9 tex, int nRow, int nCol,int nWidth,int nHeight,float nFrameSpan, int nNumOfFrame,int nLayer)
:SpriteMultiFrame(tex,nRow,nCol,nWidth,nHeight,nFrameSpan,nNumOfFrame,nLayer)
{
	m_nSpeed=90*D3DX_PI/180;
	m_centerx=300;
	m_centery=200;
	m_ro=100;
	m_th=0;

	m_vCenter.x=0;
	m_vCenter.y=0;
}

SpriteLight::~SpriteLight()
{

}

bool SpriteLight::Update( DWORD dwCurrentTime )
{  

	m_th += m_nSpeed * (dwCurrentTime-m_nLastTime)/1000;   

    if( m_th > 2*D3DX_PI )
        m_th = 0;
	
	m_vPosition.x=m_centerx+m_ro*cos(m_th);
	m_vPosition.y=m_centery+m_ro*sin(m_th);


	return true;
}
